Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix intermittent ConcurrentModificationException thrown from codegen #5812

Merged
merged 1 commit into from
Jan 20, 2025

Conversation

zoewangg
Copy link
Contributor

@zoewangg zoewangg commented Jan 20, 2025

Motivation and Context

Fix intermittent ConcurrentModificationException thrown from codegen

Failed to execute goal software.amazon.awssdk:codegen-maven-plugin:2.30.3-SNAPSHOT:generate (default) on project codegen-generated-classes-test: Execution default of goal software.amazon.awssdk:codegen-maven-plugin:2.30.3-SNAPSHOT:generate failed: Failed to generate code. Exception message : java.lang.RuntimeException: java.util.ConcurrentModificationException -> [Help 1]

The root cause is that we are sorting an ArrayList while iterating.

Modifications

Updated the code to not sort the list while iterating

@zoewangg zoewangg changed the title Troubleshoot flaky tests Fix intermittent ConcurrentModificationException thrown from codegen Jan 20, 2025
@zoewangg zoewangg marked this pull request as ready for review January 20, 2025 18:33
@zoewangg zoewangg requested a review from a team as a code owner January 20, 2025 18:33
Copy link
Contributor

@L-Applin L-Applin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works, but just pointing out that we probably could as well return a new list here in the HttpChecksum class

@zoewangg
Copy link
Contributor Author

This works, but just pointing out that we probably could as well return a new list here in the HttpChecksum class

The root cause seems to be the use of collections.sort on an ArrayList, so unless we return a concurrently modifiable list, it may have the same issue.

@zoewangg zoewangg enabled auto-merge January 20, 2025 18:53
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
66.7% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@zoewangg zoewangg added this pull request to the merge queue Jan 20, 2025
Merged via the queue into master with commit d8e5923 Jan 20, 2025
16 of 17 checks passed
@zoewangg zoewangg deleted the zoewang/flakyTests branch January 20, 2025 20:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants